package threads;

import java.io.IOException;
import java.net.DatagramPacket;
import java.net.DatagramSocket;
import java.net.InetAddress;
import java.net.SocketAddress;

public class MulticastServerIp extends Thread {

	private static final int SEND_MULTICAST_IP_PORT = 4448;
	private static final long TIME_SEND_IP = 4000;//om de 4 sec

	@Override
	public void run() {
		super.run();
		while(true){
			try{
				DatagramSocket dgs = new DatagramSocket();
				InetAddress group = InetAddress.getByName("230.0.0.1");
				String ip = "my IP";
				
				DatagramPacket packet = new DatagramPacket(ip.getBytes(), ip.length(), group, 4448);
				dgs.send(packet);
				dgs.close();
				this.sleep(TIME_SEND_IP);
				
			}catch(IOException e){
				
			} catch (InterruptedException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}
	}
	
	

}
